def fuzzy_search(input, business_file='/home/lxy/wxbdata/merge_website_replace.jsonl', top_k:int=3, threshold:int=20):
    '''
    args:
        input:用户输入\n
        business_file:匹配的文件路径\n
        top_k:返回多少个\n
        threshold:分数阈值\n
    return:
        return_prompts:返回的个数\n
        key:gpt提取的关键字\n
        scores:return_prompts里面的每个的分数\n
    '''
    from request_chatgpt_myy import make_requests
    from thefuzz import fuzz
    import json

    # 请求GPT获得现在办理的业务名称
    prompt = "以下是用户在东北大学信网办业务时向系统助手提问的问题，帮我抽取出用户具体在办理哪一个业务，只回复业务名称，没有则返回用户的原问题，其他不要回复\n"
    prompt += f"用户问题：{input}\n"
    prompt += f"业务名称：{input}\n"
    prompt = {"role": "user", "content": prompt}

    response = make_requests(
        engine="gpt-3.5-turbo",
        prompts=[prompt],
        temperature=0,
        top_p=0.9,
        frequency_penalty=0,
        presence_penalty=2,
        stop_sequences=[]
    )
    key = response[0]["response"]["choices"][0]["message"]["content"]

    # 模糊匹配
    business_list = list()
    business_file = open(business_file, "r", encoding="utf-8")
    lines = business_file.readlines()
    for line in lines:
        line_dict = json.loads(line)
        _key = line_dict["name"]
        line_dict["score"] = fuzz.ratio(key, _key)
        business_list.append(line_dict)

    # 取topk个
    return_prompts = list()
    scores = list()
    business_list.sort(key=lambda x:x["score"])
    for i in range(top_k):
        business = business_list.pop()
        if business["score"] < threshold:
            continue
        name = business["name"]
        procedure = business["procedure"]
        condition = business["condition"]
        website = business["website"]
        department = business["department"]
        return_prompt = f"业务名称：{name}\n" # 用的\n
        return_prompt += f"办理流程：{procedure}\n"
        return_prompt += f"负责部门：{department}\n"
        return_prompt += f"办理网址：{website}\n"
        return_prompts.append(return_prompt)
        scores.append(business["score"])

    return return_prompts

